package test;

import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import expression.*;

@SuppressWarnings("javadoc")
public class AdamWentzelPETest
{
	@Before
	public void setUp() throws Exception
	{
	}

	@After
	public void tearDown() throws Exception
	{
	}

	/*
	 * Feel free to add comments if I made a mistake.
	 */
	@Test
	public void testPostfixEvaluator()
	{
		assertEquals(100, PostfixEvaluator.eval("2 2 2 ^ ^ 2 / 2 / 5 * 5 * 10 + 5 + 5 - 10 - 0 + 0 -"));
		assertEquals(3, PostfixEvaluator.eval("100 200 * 20000 / 2 +"));
		assertEquals(2, PostfixEvaluator.eval("1 4 2 / ^ 4 * 5 + 6 1 + -"));
		assertEquals(256, PostfixEvaluator.eval("2 2 ^ 2 2 ^ 2 2 2 / 2 2 * 2 * + 1 - * 2 2 2 ^ ^ / ^ ^"));
		assertEquals(-2, PostfixEvaluator.eval("1 2 + 9 2 3 + 40 4 / * 3 ^ ^ / 2 -"));
		assertEquals(1, PostfixEvaluator.eval("61 61 * 61 * 7 9 * 2 - 3 ^ 1 + 5 + 6 - 3 / 3 * /"));
		assertEquals(1, PostfixEvaluator.eval("2 3 1 + ^ 6 2 + 2 / 2 ^ /"));
	}
}
